package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.UserCertificateMapper;
import com.ly.heart.service.IUserCertificateService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.UserCertificateEntity;

import javax.annotation.Resource;

/**
 * 人员证书记录Service业务层处理
 * @author wutao
 * @date 2024-05-31
 */
@Service
public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateMapper, UserCertificateEntity> implements IUserCertificateService {

    @Resource
    private UserCertificateMapper userCertificateEntityMapper;

    /**
     * 查询人员证书记录
     * @param id 人员证书记录ID
     * @return 人员证书记录
     */
    @Override
    public UserCertificateEntity selectUserCertificateEntityById (String id) {
        return userCertificateEntityMapper.selectUserCertificateEntityById ( id );
    }

    /**
     * 查询人员证书记录列表
     * @param userCertificateEntity 人员证书记录
     * @return 人员证书记录
     */
    @Override
    public List<UserCertificateEntity> selectUserCertificateEntityList (UserCertificateEntity userCertificateEntity) {
        return userCertificateEntityMapper.selectUserCertificateEntityList ( userCertificateEntity );
    }

    /**
     * 新增人员证书记录
     * @param userCertificateEntity 人员证书记录
     * @return 结果
     */
    @Override
    public int insertUserCertificateEntity (UserCertificateEntity userCertificateEntity) {
        userCertificateEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        userCertificateEntity.setCreateTime ( DateUtils.getNowDate () );
        return userCertificateEntityMapper.insertUserCertificateEntity ( userCertificateEntity );
    }

    /**
     * 修改人员证书记录
     * @param userCertificateEntity 人员证书记录
     * @return 结果
     */
    @Override
    public int updateUserCertificateEntity (UserCertificateEntity userCertificateEntity) {
        userCertificateEntity.setUpdateTime ( DateUtils.getNowDate () );
        return userCertificateEntityMapper.updateUserCertificateEntity ( userCertificateEntity );
    }

    /**
     * 批量删除人员证书记录
     * @param ids 需要删除的人员证书记录ID
     * @return 结果
     */
    @Override
    public int deleteUserCertificateEntityByIds (String[] ids) {
        return userCertificateEntityMapper.deleteUserCertificateEntityByIds ( ids );
    }

    /**
     * 删除人员证书记录信息
     * @param id 人员证书记录ID
     * @return 结果
     */
    @Override
    public int deleteUserCertificateEntityById (String id) {
        return userCertificateEntityMapper.deleteUserCertificateEntityById ( id );
    }
}
